package com.funfei.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import com.funfei.view.ViewExcel;
import com.funfei.view.ViewPDF;

@Controller
@RequestMapping("/view")
public class ViewController extends MultiActionController {
	@RequestMapping("/pdf")
	public ModelAndView viewPDF() throws Exception {
		List<String> list = new ArrayList<String>();
		Map<String, Object> model = new HashMap<String, Object>();
		list.add("test1");
		list.add("test2");
		model.put("list", list);
		ViewPDF viewPDF = new ViewPDF();
		return new ModelAndView(viewPDF, model);
	}

	@RequestMapping("/excel")
	public ModelAndView viewExcel() throws Exception {
		List<String> list = new ArrayList<String>();
		Map<String, Object> model = new HashMap<String, Object>();
		list.add("test1");
		list.add("test2");
		model.put("list", list);
		ViewExcel viewExcel = new ViewExcel();
		return new ModelAndView(viewExcel, model);
	}
}
